import { useI18n } from '/@/hooks/web/useI18n';
import { BasicColumn, BasicTableProps, FormProps } from '/@/components/Table';
// import { userListData } from '/@/api/sys/user';
import { m8OrderFlowFhIdsListData,listSelectData } from '/@/api/m8/order/flow/fh/m8OrderFlowFh';

const { t } = useI18n('sys.empUser');

const modalProps = {
  title: t('发货详情选择'),
};

const searchForm: FormProps = {
  baseColProps: { lg: 6, md: 8 },
  labelWidth: 80,
  showResetButton:false,
  schemas: [
    {
      label: 'selIds',
      field: 'selIds',
      component: 'Input',
      show: false,
    },
    {
      label: '是否红字',
      field: 'djNo.bred',
      component: 'Input',
      show: false,
    },
    {
      label: '发货单号',
      field: 'djNo.djNo',
      component: 'Input',
      show: true,
    },
    {
      label: t('订单号'),
      field: 'order.ccode',
      component: 'Input',
    },
    {
      label: t('图号'),
      field: 'orderPic.picno',
      component: 'Input',
    },
    {
      label: t('名称'),
      field: 'orderPic.picname',
      component: 'Input',
    },
    {
      label: t('客户'),
      field: 'djNo.cusCode',
      component: 'Input',
    },
    {
      label: t('用户'),
      field: 'djNo.userCode',
      component: 'Input',
    },
  ],
};

const tableColumns: BasicColumn[] = [
  {
    title: t('发货单号'),
    dataIndex: 'djNo.djNo',
    key: 'a.dj_no',
    sorter: true,
    width: 150,
  },
  {
    title: t('剩余退货数量'),
    dataIndex: 'syBackQty',
    key: 'sy_Back_qty',
    sorter: true,
    width: 100,
  },
  {
    title: t('发货数量'),
    dataIndex: 'iqty',
    key: 'iqty',
    sorter: true,
    width: 100,
  },
  {
    title: t('累积退货数量'),
    dataIndex: 'sumBackQty',
    key: 'sum_back_qty',
    sorter: true,
    width: 100,
  },


  {
    title: t('客户'),
    dataIndex: 'djNo.cusCode',
    key: 'fh.cus_code',
    sorter: true,
    width: 100,
    dictType: 'M8_cus',
  },
  {
    title: t('订单号'),
    dataIndex: 'order.ccode',
    key: 'orders.ccode',
    sorter: true,
    width: 100,
  },
  {
    title: t('图号'),
    dataIndex: 'orderPic.picno',
    key: 'pic.picno',
    sorter: true,
    width: 100,
  },
  {
    title: t('名称'),
    dataIndex: 'orderPic.picname',
    key: 'pic.picname',
    sorter: true,
    width: 100,
  },
];

const tableProps: BasicTableProps = {
  api: listSelectData,
  beforeFetch: (params) => {
    return params;
  },
  columns: tableColumns,
  formConfig: searchForm,
  rowKey: 'id',
};

export default {
  modalProps,
  tableProps,
  itemCode: 'id',
  itemName: 'id',
};
